
package CPUfile;

use strict;

use vars qw($DEBUG %mapnotes %pentiumlist);

$DEBUG = 0;
#
# Parse the /proc/cpuinfo file and return an one-liner characterizing the CPU
#
# The information comes from the LInux kernel.
# On 2.4.27, x86 info is from arch/i386/kernel/setup.c, procedure show_cpuinfo
# Also implicated is asm/cpufeature.h, apparently.
#
# The content varies quite a bit between architectures.
# This file contains some generic parsing routines, and a switch to call
# the right arch-specific module's parser
#

sub parse {
    my $arch = shift; # architecture from uname()
    my $kernel = shift;
    my $cpufile = shift; # entire content of /proc/cpuinfo

    if ($arch eq "i686" || $arch eq "i586") {
	require CPUfile::Intel;
	return CPUfile::Intel::parse($arch, $kernel, $cpufile);
    } elsif ($arch eq "alpha") {
	require CPUfile::Alpha;
	return CPUfile::Alpha::parse($arch, $kernel, $cpufile);
    } else {
	return "Unknown arch $arch/0";
    }
}

1;
